﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _plants_vs_zombies
{

    /// <summary>
    /// 
    /// </summary>
    class Plant
    {
        /// <summary>
        /// 初始化plant的rectangle
        /// </summary>
        public Rectangle Rectangle { get; set; }
        
        /// <summary>
        /// type of plant
        /// </summary>
        public BlockStatus PlantType { get; set; }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="rectangle"></param>
        /// <param name="plantType"></param>
        public Plant(Rectangle rectangle, BlockStatus plantType)
        {
            Rectangle = rectangle;
            PlantType = plantType;
        }

        /// <summary>
        /// 根据状态绘制Plant
        /// </summary>
        /// <param name="g"></param>
        public void Draw(Graphics g)
        {
            //画mouseblock的框
            g.DrawRectangle(new Pen(Color.Yellow), Rectangle);
            switch (PlantType)
            {
                case BlockStatus.向日葵:
                    g.DrawImage(Properties.Resources.向日葵2, Rectangle);
                    break;
                case BlockStatus.豌豆射手:
                    g.DrawImage(Properties.Resources.豌豆射手1, Rectangle);
                    break;
                case BlockStatus.铲子:
                    g.DrawImage(Properties.Resources.铲子, Rectangle);
                    break;
                case BlockStatus.土豆:
                    g.DrawImage(Properties.Resources.tudou1, Rectangle);
                    break;
                default:
                    break;
            }
        }
    }
}
